588A Duff and Meat codeforces solution in cpp
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
main()
{
int n,p,a,i,sum=0,r=1000;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a>>p;
if(p<r) r=p;
sum+=r*a;
}
cout<<sum<<endl;
return 0;
}
588A Duff and Meat codeforces solution in cpp
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
main()
{
int n,p,a,i,sum=0,r=1000;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a>>p;
if(p<r) r=p;
sum+=r*a;
}
cout<<sum<<endl;
return 0;
}
0 Comments